home *** CD-ROM | disk | FTP | other *** search
/ Merciful 2 / Merciful - Disc 2.iso / software / d / devioustools25.dms / devioustools25.adf / utils / 003.lzx / AMountains / ModeID.c < prev    next >
C/C++ Source or Header  |  2004-02-13  |  835b  |  32 lines

  1. /************************************************************************/
  2. /*                                                                        */
  3. /* ULONG ModeID( char * )                                                */
  4. /*                                                                        */
  5. /* Returns the display mode identifier of a    given monitor:mode name.    */
  6. /* E.g. ModeID( "NTSC:HighRes Lace" ) resolves to 0x00019004.            */
  7. /*                                                                        */
  8. /************************************************************************/
  9.  
  10. #include <graphics/displayinfo.h>
  11.  
  12. #include <proto/graphics.h>
  13.  
  14. #include <string.h>
  15.  
  16. ULONG ModeID( char *name )
  17. {
  18.     ULONG            id    = INVALID_ID;
  19.     struct NameInfo    ni;
  20.  
  21.     while ( ( id = NextDisplayInfo( id ) ) != INVALID_ID ) {
  22.         if ( ! ModeNotAvailable( id ) ) {
  23.             if ( GetDisplayInfoData( NULL, (UBYTE *) &ni, sizeof( struct NameInfo ), DTAG_NAME, id ) ) {
  24.                 if ( ! stricmp( name, ni.Name ) ) {
  25.                     break;
  26.                 }
  27.             }
  28.         }
  29.     }
  30.     return id;
  31. }
  32.